import { setToken as requestSetToken } from './utils/request';

let tokenGetter;

export function setToken(getter) {
    tokenGetter = getter;
}

export function userToken() {
    if (tokenGetter) {
        return tokenGetter();
    }
    return '';
}

requestSetToken(userToken);

/**
 * 默认分页
 * @type {number}
 */
export const defaultPageSize = 30;

//弹出窗口最大宽度
export const maxWidthModal = 1000;

//相应宽度
export const responseWidth = () => Math.min(maxWidthModal, window.innerWidth - 10);

/**
 * 默认表单编辑器col属性
 * @type {{span: number}}
 */
export const defaultEditorColProps = {
    xs: {
        span: 24
    },
    sm: {
        span: 12
    },
};

/**
 * 默认表单编辑器FormItem
 * @type {{labelCol: {span: number}, wrapperCol: {span: number}}}
 */
export const defaultEditorFormItemProps = {
    labelCol: { span: 6 },
    wrapperCol: { span: 14 },
};
